package com.wwl.cms.utils.designModeTest.memento.theory;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/9/26 18:41
 * @description:
 */
public class Client {
    public static void main(String[] args) {
        Originator originator = new Originator();
        Caretaker caretaker = new Caretaker();

        originator.setState("状态#1 攻击力 100");
        //保存了当前的状态
        caretaker.add(originator.saveStateMemento());

        originator.setState("状态#2 攻击力 80");
        caretaker.add(originator.saveStateMemento());

        originator.getStateFromMemento(caretaker.get(0));

        System.out.println("当前的状态是="+originator.getState());

    }
}
